<?php
declare (strict_types=1);

namespace app\validate;

use think\Validate;

class WenzhangValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require',
        'name' => 'require|max:100',
        'content' => 'require|min:10'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'name.require' => 'name 必填',
        'id.require' => 'id 必填',
        'name.content' => 'content 必填'
    ];

    protected $scene = [
        'modify'  =>  ['name','content'],
        'add'  =>  ['name','content'],
        'update'  =>  ['id','name'],
        'del'  =>  ['id'],
    ];
}
